<?php
session_start();
 require_once('../include/connect.inc.php');
 if($_SESSION['sess_id'] <> session_id()){
?>
 <SCRIPT LANGUAGE="JavaScript">
			alert("กรุณาเข้าสู่ระบบให้ถูกต้องตามขั้นตอน...!");
			location="login.php";
</script>
<?php }?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Model Test Program</title>
<link rel="stylesheet" type="text/css" href="../template/template_style_wood.css">
</head>

<body>
<div id="menu"><div><img src="../images/icon-m.png" /></div>
<div id="menulinks">
		<a href="../person.php">จัดการบุคลากร</a>
		<a class="active" href="admin_resive.php">ตรวจสอบความคิดเห็น</a>
        <a href="../new/manage_news.php">ประกาศข่าวสาร</a>
        <a href="../logout.php">ออกจากระบบ</a>
		</div></div>
        
      <div id="p3">    
<div id="header"></div>
<div id="page"><div id="p1">คุณ<?php echo"$admin_name";?><hr />
<form id="form1" name="form1" method="post" action="">
  <table id="table" >
    <tr>
      <th width="12%" align="center">ลำดับที่</th>
      <th  align="center">หัวข้อความคิดเห็น</th>
      <th  align="center">วันที่ส่ง</th>
      <th  align="center">ผู้ส่ง</th>
      <th align="center">ลบ</th>
    </tr>
<? 
$number=0;
	$query = query("SELECT * FROM tb_problem 
	Inner Join   tb_teacher ON  tb_teacher.r_teacher_id = tb_problem.r_teacher_id order by problem_id desc");
		while ($rs = fetch_array($query)) {
			$prob_id=$rs['problem_id'];
			$prob_topic = $rs['prob_topic'];
			$date= $rs['date'];
			$r_teacher_id= $rs['r_teacher_id'];
			$teacher_name = $rs['teacher_fname']." ".$rs['teacher_lname'];
			$number++;
?>
    <tr>
      <td align="center"><? echo $number; echo "."; ?></td>
      <td><a href="admin_read.php?problem_id=<? echo $prob_id;?>"><? echo $prob_topic;?></a></td>
      <td align="center"><? echo $date;?></td>
      <td align="left"><? echo $teacher_name;?></td>
      <td align="center"><a href="del_prob.php?del_id=<? echo $prob_id;?>" onclick="return confirm('ยืนยันการลบความคิดเห็น')"><img src="../images/delete1.png" border="0" /></a></td>
    </tr>
<? }?>
  </table>
</form>
    </div>
    </div>
<div id="footer"></div>
</div>
</body>
</html>
